1: | bsort(nil) | → nil | |
2: | bsort(x . y) | → last(bubble(x . y) . bsort(butlast(bubble(x . y)))) | |
3: | bubble(nil) | → nil | |
4: | bubble(x . nil) | → x . nil | |
5: | bubble(x . (y . z)) | → if(x ≤ y,y . bubble(x . z),x . bubble(y . z)) | |
6: | last(nil) | → 0 | |
7: | last(x . nil) | → x | |
8: | last(x . (y . z)) | → last(y . z) | |
9: | butlast(nil) | → nil | |
10: | butlast(x . nil) | → nil | |
11: | butlast(x . (y . z)) | → x . butlast(y . z) | |
12: | BSORT(x . y) | → LAST(bubble(x . y) . bsort(butlast(bubble(x . y)))) | |
13: | BSORT(x . y) | → BSORT(butlast(bubble(x . y))) | |
14: | BSORT(x . y) | → BUTLAST(bubble(x . y)) | |
15: | BSORT(x . y) | → BUBBLE(x . y) | |
16: | BUBBLE(x . (y . z)) | → BUBBLE(x . z) | |
17: | BUBBLE(x . (y . z)) | → BUBBLE(y . z) | |
18: | LAST(x . (y . z)) | → LAST(y . z) | |
19: | BUTLAST(x . (y . z)) | → BUTLAST(y . z) | |